<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>jquery简易计算器</title>
	</head>
	 <script src="js/jquery-3.6.0.min.js"></script>
	 <script>
		$(function(){
			$("button").click(function(){
			var n1=parseInt($("#num1").val());
			var n2=parseInt($("#num2").val());
			var flag=$("#flag").val();
			if(flag=="+")
				{
				$("#num3").val(n1+n2);
				}
			else if(flag=="-")
				{
				$("#num3").val(n1-n2);
				}
			else if(flag=="*")
			{
				$("#num3").val(n1*n2);
			}
			else if(flag=="/")
			{
				$("#num3").val(n1/n2);
			}		
	});
	});
	 
	 </script>
	 
	<body>
	<input id="num1">
	<select id="flag">
		<option value="+">+</option>
		<option value="-">-</option>
		<option value="*">*</option>
		<option value="/">/</option>
	</select>
	<input id="num2">
	<button id="btn1">=</button>
	
	<input id="num3">
	</body>
</html>


